package com.wenlin.myproduction.bean;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * @author 文琳
 * @Email 377979485@qq.com
 * @desc
 * @time 2023-02-25 星期六 22:29
 */
public class TimePercentBean implements Parcelable {
    private String text;
    private float percent;
    private int numerator;//分子
    private int denominator;//分母

    public TimePercentBean(String text) {
        this.text = text;
    }

    public TimePercentBean(int numerator, int denominator) {
        this.numerator = numerator;
        this.denominator = denominator;
        this.percent = numerator/(float)denominator;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public float getPercent() {
        return percent;
    }

    public void setPercent(float percent) {
        this.percent = percent;
    }

    public int getNumerator() {
        return numerator;
    }

    public void setNumerator(int numerator) {
        this.numerator = numerator;
    }

    public int getDenominator() {
        return denominator;
    }

    public void setDenominator(int denominator) {
        this.denominator = denominator;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.text);
        dest.writeFloat(this.percent);
        dest.writeInt(this.numerator);
        dest.writeInt(this.denominator);
    }

    protected TimePercentBean(Parcel in) {
        this.text = in.readString();
        this.percent = in.readFloat();
        this.numerator = in.readInt();
        this.denominator = in.readInt();
    }

    public static final Parcelable.Creator<TimePercentBean> CREATOR = new Parcelable.Creator<TimePercentBean>() {
        @Override
        public TimePercentBean createFromParcel(Parcel source) {
            return new TimePercentBean(source);
        }

        @Override
        public TimePercentBean[] newArray(int size) {
            return new TimePercentBean[size];
        }
    };
}
